import { reactive } from "vue";
import { defineStore } from 'pinia';

export const useApproveStore = defineStore('approve', {
    state: () => ({
        approveMainModel: reactive({
            id: '',
            approveName: '',
            fId: '',
            flowId: '',
            flowTypeId: '',
            flowTypeName: '',
            submitUserId: '',
            submitUserName: '',
            submitTime: null,
            status: null,
            approveRecords: [],
            updateProperties:[]
        }),
        approveRecordModel: reactive({
            id: '',
            pid: '',
            flowId: '',
            nodeId: '',
            approveUserId: '',
            approveUserName: '',
            approveResult: null,
            isCheck:null,
            approveOpinion: '',
            approveTime: null,
            createTime: null,
            nextApproveRecords:[]
        }),
    }),
    actions: {
        resetApproveMainModel() {
            this.approveMainModel = {
                id: '',
                approveName: '',
                fId: '',
                flowId: '',
                flowTypeId: '',
                flowTypeName: '',
                submitUserId: '',
                submitUserName: '',
                submitTime: null,
                status: '',
                approveRecords: [],
                updateProperties:[]
            }
        },
        resetApproveRecordModel() {
            this.approveRecordModel = {
                id: '',
                pid: '',
                flowId: '',
                nodeId: '',
                approveUserId: '',
                approveUserName: '',
                approveResult: null,
                isCheck:null,
                approveOpinion: '',
                approveTime: null,
                createTime: null,
                nextApproveRecords:[]
            };
        },

    },
});